    function changedate() {
        // フォームと各年月日のname属性を指定
        var formN   = document.form1;
        var tYear   = formN.year;
        var tMonth  = formN.month;
        var tDays   = formN.days;

        var selectY = tYear.options[tYear.selectedIndex].value;
        var selectM = tMonth.options[tMonth.selectedIndex].value;
        var selectD = tDays.options[tDays.selectedIndex].value;

        var dateObj = new Date(selectY, selectM, 0);

        tDays.length = 0;
        for (var i = 1;i <= dateObj.getDate();i++) {
            tDays.options[i] = new Option(i, i);
        }

        tDays.removeChild(tDays.options[0]);
        if (selectD > tDays.length) {
            tDays.options[tDays.length - 1].selected = true;
        } else {
            tDays.options[selectD - 1].selected = true;
        }
    }